

/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-12-08 21:50:08
 * @LastEditors: GGB
 * @LastEditTime: 2021-12-09 06:04:47
 */

import { createStore, Store } from "vuex";
import { InjectionKey } from "vue";
import todos, { TodoState } from "./modules/todos"

// 1.创建 injectionKey
export const key: InjectionKey<Store<State>> = Symbol();
export interface State {
    counter: number,
    todos?: TodoState
}
export default createStore({
    state: {
        counter: 1
    },
    mutations: {
        add(state) {
            state.counter++
        }
    },
    // 导入模块
    modules: {
        todos
    }
})